import 'package:lib_module_manager/module_manager/page.dart' as module_manager;
import 'package:flutter/material.dart';
import 'package:lib_module_manager/module_manager/widgets/page_widget_state.dart';

abstract class PageWidget extends StatefulWidget {
  final Key _pageKey = const ValueKey("page");
  final Expando<module_manager.Page> _page = Expando("page");
  module_manager.Page get page => _page[_pageKey]!;

  PageWidget({Key? key, required module_manager.Page page}) : super(key: key) {
    _page[_pageKey] = page;
  }

  @override
  State<StatefulWidget> createState() {
    // ignore: no_logic_in_create_state
    return createPageWidgetState();
  }

  @protected
  @factory
  PageWidgetState<PageWidget> createPageWidgetState();
}
